import React, { Component } from 'react';
import { View } from '@tarojs/components'
import './rule.scss'
import { platform } from '../../utils/platform-settting.service'
import {h5Wx} from "../../utils/h5.service";
import {GetRequest,vcmonitor} from "../../utils/tools";
import GzhAuth  from "../../components/gzh-auth/gzh-auth"
export default class Rule extends Component{
  state = {
    phone: '',
    payVersion: Number,
    min:0,
    f:0,
    max:0
  }
  async componentDidShow(){
    vcmonitor(this)
  }
  async UNSAFE_componentWillMount() {
    if(process.env.TARO_ENV==='h5'){
      await h5Wx.getConfig()
    }
    const {min,f, max} = Taro.getCurrentInstance().router.params
    this.setState({
      min,f, max
    })
    const setting = await platform.getSetting()

    if(setting){
      this.setState({ phone: setting.platformServicePhone ,payVersion:setting.payVersion})
    }
  }
  render() {
    const {payVersion,min,f, max} = this.state;
    return (
      <View className="rule-page-root">
        <GzhAuth />
        <View className="page__bd">
          <View className="weui-form-preview">
            <View className="weui-form-preview__hd">
              <View className="weui-form-preview__tit">
                提现规则
              </View>
            </View>
            <View className="weui-form-preview__bd">
              <View className="weui-form-preview__item">
                <View className="weui-form-preview__label">提现时间</View>
                <View className="weui-form-preview__value">8:00 - 20:00 (工作日)</View>
              </View>
              <View className="weui-form-preview__item">
                <View className="weui-form-preview__label">到账时间</View>
                <View className="weui-form-preview__value">最晚48小时内到账</View>
              </View>
              <View className="weui-form-preview__item">
                <View className="weui-form-preview__label">提现次数</View>
                <View className="weui-form-preview__value">当日最多1次</View>
              </View>

              <View className="weui-form-preview__item">
                <View className="weui-form-preview__label">提现手续费</View>
                <View className="weui-form-preview__value">{payVersion ? f+'元': '无' }</View>
              </View>
            </View>
          </View>
          {!payVersion && <View className="weui-form-beizhu">
            <View className="weui-li">仅支持提现到微信零钱。</View>
            <View className="weui-li">出现提现失败，请联系：{this.state.phone}。</View>
          </View>
          }
        </View>
      </View>
    )
  }
}
